<include file="__THEME__/header" />
<script>
function changeverify(){
    var date = new Date();
    var ttime = date.getTime();
    var url = "{:U('index/Advise/verify')}";
    $('#verifyimg').attr('src',url+'&'+ttime);
}
</script>

<div class="content">
  <div class="main no_l">
    <div class="mainbox">
      <div class="mainbox_R">
        <div class="right_list">
          <div class="right_list_on">
            <div><a href="{:U('index/Advise/index')}">给我们提建议</a></div>
          </div>
          <div class="right_list_def">
            <div><a href="{:U('index/About/aboutus')}">关于我们</a></div>
          </div>
          <div class="right_list_def">
            <div><a href="{:U('index/About/contactus')}">联系我们</a></div>
          </div>
          <div class="right_list_def">
            <div><a href="{:U('index/About/friendlink')}">友情链接</a></div>
          </div>
        </div>
      </div>
      
      <div class="mainbox_CR">
        <div class="reg_box">
          <h2 class="cBlue"><strong>给我们提建议</strong></h2>
          <p style="padding: 5px 10px 30px;" class="cGray lineS_btm lh20 mLR15"></p>
        </div>
        <div class="message">
          <form action="{:U('index/Advise/add')}" method="post" enctype="multipart/form-data" onsubmit="return docheckAll()">
            <textarea name="adv_content"  id="adv_content" style="width: 98%;" rows="3"cols="" class="message_text text"></textarea>
            <input type="text" class="text" style="width:100px;" name="verify" id="verify" require="true" value="" datatype="require"  msg="验证码不能为空"/>
            <a href="javascript:void(0);" onclick="changeverify()"><img src="{:U('home/public/verify')}" id="verifyimg" alt="换一张" /></a><br/>
            <input type="submit" name="button" id="button" value="提交" onclick="docheckAll()" class="N_but right"/>
          </form>
        </div>
        <volist name="list" id="vo">
          <div class="message" id="adv_{$vo['adv_id']}">
            <ul>
              <li> <em>
                <php>if($admin_level==1){</php>
				
                <a href="javascript:void(0);"  onclick="ui.confirm(this,'确认要删除这条留言?')" callback="Del({$vo['adv_id']});">删除</a>
                <php>}</php>
                {$vo['ctime']|friendlyDate}</em>
                <space uid="vo.from_uid">{uavatar=s}</space>
                {$vo['from_uname']}</li>
            </ul>
            <p class="message_text">{$vo['content']}</p>
          </div>
        </volist>
        <div class="clear"></div>
        <div class="page">{$page}</div>
       
      </div>
      
      
    </div>
    <div class="clear"></div>
  </div>
</div>
<script>
function docheckAll(){
var adv_content=$('#adv_content').val();	
var verify=$('#verify').val();
     if(verify==''){
	  ui.error('请输入验证码');
	  return false;
     }else if(adv_content==''){
	
	  ui.error('请输入建议内容');
	  return false;
	 }	
}
function Del(adv_id){
     $.get(U('index/Advise/deladv'),{id:adv_id},function(res){
         if(res==1){
		    $('#adv_'+adv_id).remove();
		    ui.success('删除成功');
			ui.box.close();
		 }else{
		    ui.error('删除失败');
		 }
     });
}
</script> 
<include file="__THEME__/footer" />